Add ability for Eshell virtual targets to handle closing the target
authorJim Porter <jporterbugs@gmail.com>
Thu, 23 May 2024 21:52:07 +0000 (14:52 -0700)
committerJim Porter <jporterbugs@gmail.com>
Wed, 29 May 2024 19:09:05 +0000 (12:09 -0700)
commit9daf1085a9b11e056079edce8dccca92d69bf891
tree955af8fdd760efca90732a9742e04d4d2f5a6712
parent4c924a53334035dc4089b24174012b54c020631b
Add ability for Eshell virtual targets to handle closing the target

This was documented to work by calling the output function with 'nil',
but that was never actually implemented.  Instead, for compatibility,
we now support a new (optional) close function.

* lisp/eshell/esh-io.el (eshell-virtual-targets): Update docstring.
(eshell-generic-target): New struct...
(eshell-function-target): ... inherit from it, and rename from
'eshell-virtual-target'.
(eshell-get-target): Handle already-created 'eshell-generic-target'.
(eshell-close-target): Call the target's close function if present.

* test/lisp/eshell/esh-io-tests.el (esh-io-test/virtual/device-close):
New test.

* doc/misc/eshell.texi (Redirection): Document the new behavior.
doc/misc/eshell.texi
lisp/eshell/esh-io.el
test/lisp/eshell/esh-io-tests.el